/* 
Scenic Graphics Library
Copyright (C) 2007 Jouni Tulkki

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USApackage scenic;
*/

#ifndef Scenic_Renderer_common_h
#define Scenic_Renderer_common_h

#include <stdio.h>
#include <math.h>
#include <string.h>

#ifdef DIRECTX
#include <windows.h>
#include <d3dx9.h>
#endif
#ifdef OPT_OPENGL
#include <GL/gl.h>
#ifdef OPT_X11
#include <X11/X.h>
#include <GL/glx.h>
#endif
#include "GLExtensions.h"
#endif

#ifndef M_PI
	#define M_PI 3.1415926535
#endif

#ifdef OPT_X11
	#define __stdcall
#endif

#ifdef DIRECTX
#define strdup _strdup
#endif

#ifndef max
	#define max(a, b) ((a) > (b) ? (a) : (b))
	#define min(a, b) ((a) < (b) ? (a) : (b))
#endif


namespace Scenic
{
namespace Renderer
{

enum Format
{
	FMT_UNKNOWN = -1,
	FMT_A8R8G8B8 = 0,
	FMT_R8G8B8 = 1,
	FMT_L8 = 2,
	FMT_A8 = 3,
	FMT_AL8 = 4,
	FMT_R8G8B8A8 = 5,
	FMT_ABGR_16F = 6,
	FMT_ABGR_32F = 7,
	FMT_AL_32F = 8,
	FMT_AL_64F = 9,
	FMT_A8B8G8R8 = 10,
	FMT_X8R8G8B8 = 11,
	FMT_X8B8G8R8 = 12,
	FMT_R8G8B8X8 = 13,
	FMT_B8G8R8X8 = 14,
	FMT_B8G8R8A8 = 15,
	FMT_A1R8G8B8 = 16,
	FMT_COUNT
};

enum Usage
{
	USAGE_RENDER_TARGET = 1,
	USAGE_PREMULTIPLIED_ALPHA = 2
};

enum CapStyle
{
	BUTT_CAP = 0,
	ROUND_CAP = 1,
	SQUARE_CAP = 2
};

enum JoinStyle
{
	MITER_JOIN = 0,
	ROUND_JOIN = 1,
	BEVEL_JOIN = 2
};

enum GradientType
{
	LINEAR_GRADIENT = 0,
	RADIAL_GRADIENT = 1,
	SQUARE_GRADIENT = 2,
	CONICAL_GRADIENT = 3,
	TILE_GRADIENT = 4
};

enum SurfaceType
{
	SURFACE_TYPE_COLOR = 0,
	SURFACE_TYPE_ALPHA = 1,
	SURFACE_TYPE_ALPHA2X = 2,
	SURFACE_TYPE_ALPHA4X = 3
};

enum AttributeType
{
	ATTRIBUTE_TYPE_CHAR = 0,
	ATTRIBUTE_TYPE_SHORT = 1,
	ATTRIBUTE_TYPE_INT = 2,
	ATTRIBUTE_TYPE_FLOAT = 3
};

enum Attribute
{
	POSITION_ATTRIBUTE = 0,
	COLOR_ATTRIBUTE = 1,
	TEXCOORD_ATTRIBUTE = 2,
	ATTRIBUTE_SIZE
};

enum FragmentParameter
{	
	COLOR_FP = 0,
	FP_SIZE = 1
};

#define PRIMITIVE_MAX_TEXTURES 1

// #include "PolygonRenderer.h"

char *getErrorName(int code);

}
}

#include "Util.h"
#include "Resource.h"
#include "Graphics.h"

#include "VertexStore.h"
#include "Image.h"
#include "Canvas.h"
#include "Context.h"
#include "LineRenderer.h"

#include "Debug.h"


#endif
